/*
 * @Author: C.
 * @Date: 2023-04-20 09:38:51
 */
import { defHttp } from '/@/utils/http/axios';

enum Api {
  Upload = '/files/upload_files',
  Download = '/files/down_file',
  UploadImg = '/files/upload_image',
  FileAttachment = '/file_attachment/get',
}

export const uploadFile = (params: any) => {
  return defHttp.post<any>({ url: Api.Upload, params });
};
export const downFile = (params: any) => {
  return defHttp.post<any>(
    {
      url: Api.Download,
      params,
      responseType: 'blob',
    },
    { isReturnNativeResponse: true },
  );
};

export const uploadImg = (params: any) => {
  return defHttp.post<any>({ url: Api.UploadImg, params });
};

// GET /api/file_attachment/get
// 根据单据编号获取附件列表
export const fileAttachment = (params: any) => {
  return defHttp.get<any>({ url: Api.FileAttachment, params });
};
